#include<iostream>
using namespace std;
void BubbleSort(int *a,int len)
{
    for(int i=0;i<len;i++)
     {      
        int exchage=1;
        for(int j=1;j<len-i;j++)
        {
            if(a[j]>a[j-1])
            {
                swap(a[j],a[j-1]);
                exchage=0;
            }
            
        }
        if(exchage)break;
     }
}
int main()
{
    int a[]={1,5,6,7,41,2,3,6};
    BubbleSort(a,sizeof(a)/sizeof(a[0]));
    for(int i=0;i<8;i++)
        cout<<a[i]<<" ";
}